package vn.edu.ptithcm.pim.service;

import org.springframework.security.authentication.encoding.PasswordEncoder;

import nl.flotsam.xeger.Xeger;

public class SpringSercurityService {
	private PasswordEncoder passwordEncoder;
	private Xeger passwordGenerator;

	public String encodePassword(String rawPass, Object salt) {
		return getPasswordEncoder().encodePassword(rawPass, salt);
	}

	public boolean isPasswordValid(String encPass, String rawPass, Object salt) {
		return getPasswordEncoder().isPasswordValid(encPass, rawPass, salt);
	}

	public PasswordEncoder getPasswordEncoder() {
		return passwordEncoder;
	}

	public void setPasswordEncoder(PasswordEncoder passwordEncoder) {
		this.passwordEncoder = passwordEncoder;
	}

	public Xeger getPasswordGenerator() {
		return passwordGenerator;
	}

	public void setPasswordGenerator(Xeger passwordGenerator) {
		this.passwordGenerator = passwordGenerator;
	}

}
